DistributedEO
by Eric Noyau, NeXT Engineering

Overview

An example of how to use Foundation objects and Enterprise Objects with 3.x style Distributed Objects. The example uses the PEOPLE database that you can generate yourself by running the attached script installPEOPLE.sqlsybase.
Note that the EMPLOYEE Table has a new attribute named LOCK to prevent concurrent updates of the same record in the database.

Program Organization

Major Classes in the Application
 
AppManager	An object responsible for initializing all objects used in the program. It serves as a communication channel with EOF by becoming the delegate of EODatabaseChannel and EOAdaptorContex.  

DEONotificationCenter	Works like an NSNotificationCenter. There is one DEONotificationCenter per entity. Encodes the enterprise objects that belongs to that entity over the wire. In this example, there is only one DEONotificationCenter that corresponds to the EMPLOYEE entity.

DEOServerMonitor	Responsible for watching the communication between the server and all DEONotificationCenters in the client. If the connection between client and server becomes invalid, it broadcasts a NSNotification to inform the death of the server.

DEOServer	Registers or unregisters clients. Dispatches messages to clients. 

 

NOTES

This program will not allow you to update the primary key. Update operations can only be performed on non-primary key fields of the records.

This program can be extended with DELETE and INSERT operations, such as enhancing the AppManager to track added and deleted objects:

- (void)databaseChannel:channel didDeleteObject:anEO;
- (void)databaseChannel:channel didInsertObject:anEO;

WARNING

Due to race conditions, if you launch the application on two machines at the same time, you will end up with two servers running. And the notifications are not propagated correctly. To avoid this problem, you should: 
1- put the server on a known machine and remove all the server auto-lauching code from the client.
2- remove the "*" in connectToName:onHost: and replace it by the name of the server host

Valid for EOF Release Version 1.1 only

Last Edited:  Mai Nguyen, 02/17/95